package com.sql.controller;

import com.sql.pojo.MySql;
import com.sql.service.impl.MySqlServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SqlController {

    @Autowired
    private MySqlServiceImpl mySqlService;

    @RequestMapping(value = "/saveMysql", method = RequestMethod.GET)
    public void saveMysql() {
         mySqlService.save(null);
    }

    @RequestMapping(value = "/findMysql", method = RequestMethod.GET)
    public void findMysql() {
        List<MySql> mySqlList = mySqlService.find();
        for (MySql mySql : mySqlList) {
            System.out.println(mySql.getId());
        }
    }

}
